<template>
  <div class="rose-echarts">
    <base-echarts :options="option"></base-echarts>
  </div>
</template>

<script setup lang="ts">
import baseEcharts from './base-echarts.vue'
import { computed } from 'vue'
import type { EChartsCoreOption } from 'echarts'
import type { commonDataType } from '../types'
const props = defineProps<{
  roseData: commonDataType[]
}>()

const option = computed<EChartsCoreOption>(() => {
  return {
    legend: {
      orient: 'horizontal',
      left: 'center'
    },
    toolbox: {
      show: true,
      itemSize: '15',
      orient: 'vertical',
      right: '10',
      feature: {
        mark: { show: true },
        dataView: { show: true, readOnly: false },
        restore: { show: true },
        saveAsImage: { show: true }
      }
    },
    tooltip: {
      trigger: 'item'
    },
    series: [
      {
        name: '访问来源',
        type: 'pie',
        bottom: '-15%',
        radius: [10, 100],
        center: ['50%', '50%'],
        roseType: 'area',
        itemStyle: {
          borderRadius: 8
        },
        data: props.roseData
      }
    ]
  }
})
</script>

<style lang="less" scoped>
.rose-echarts {
  h2 {
    color: red;
  }
}
</style>
